<?
  include_once('lib/database.php');
  include_once('lib/cq-io.php');
?>
<h2>Code Generation</h2>
<form action="./?">
  Create new 
  <select name="cmd">
    <option value="create-controller">Controller</option>
    <option value="create-model">Model</option>
    <option value="create-gadget">Gadget</option>
    <option value="create-theme">Theme/Skin</option>
    <option value="create-custom">Custom Library</option>
    <option value="create-l10n">Language File</option>
  </select>
  named
  <input type="text" name="entityname" value=""/>
  <input type="submit" name="OK" value="create &gt;"/>
  <div style="color: gray">Note: when creating a new Controller,
    the script automatically creates a corresponding Model class,
    an Index action and a view template for the Controller!</div>
</form>
<!--
<h2>New Action and View</h2>
<form action="scripts/?">
  Create new 
  <select name="cmd">
    <option value="create-actionview">Action + View</option>
    <option value="create-action">Action only</option>
    <option value="create-view">View only</option>
  </select>
  for
  <select name="ctrl">
  <?
    foreach (file_list('controllers/') as $ffull => $fshort)
    {
      ?><option value="<?= $fshort ?>"><?= $fshort ?></option><?
    }
  ?></select>
  named
  <input type="text" name="entityname" value=""/>
  <input type="submit" name="OK" value="create &gt;"/>
</form>
-->
<h2><a href="?">Your Project Content</a></h2>
<?
  
function makeList($l)
{
  foreach ($l as $i)
  {
    print('<div style="background: #e0ffe0; border-top: 1px solid #c0c0c0;">
      <b style="color: green">'.$i.'</b></div><ul>');
    $fles = file_list($i.'/');
    if (sizeof($fles)==0)
      print('<div style="color: gray">none</div>');
    else
      foreach ($fles as $ffull => $fshort)
      {
        ?><li><?= $fshort ?></li><?
      }
    print('</ul>');
  }
}

?><table><tr><td width="25%" valign="top"><?
  makeList(explode(',', 'models,controllers,views')); ?></td><td>&nbsp;&nbsp;</td>
<td width="25%" valign="top"><?
  makeList(explode(',', 'gadgets,custom')); ?></td><td>&nbsp;&nbsp;</td>
<td width="25%" valign="top"><?
  makeList(explode(',', 'l10n,themes')); ?></td><td>&nbsp;&nbsp;</td>
<td width="25%" valign="top">
  <?
    print('<div style="background: #e0ffe0; border-top: 1px solid #c0c0c0;">
        <b style="color: green">DB Tables</b></div><ul>');
    foreach (DB_GetTables() as $table)
      print('<li>'.$table.'</li>');
      
    print('</ul>');
  ?>
  </td><td>&nbsp;&nbsp;</td>
</tr></table>
